'use strict';
var even_group_calculate_average = function(collection){
    let arr1=[];
    let arr2=[];
    let arr3=[];
    let arr=[];

    for(let i in collection)
    {
        
        if(i%2!=0)
        {
            //arr.push(collection[i]);
            if(collection[i]%2===0)
            {
                if(parseInt(collection[i]/10)===0)
                {
                    arr1.push(collection[i]);
                }
                else if((parseInt(collection[i]/10))<10)
                {
                    arr2.push(collection[i]);
                }
                else
                {
                    arr3.push(collection[i]);
                }
            }
        }
    }
    //console.log('m');
    //console.log(arr1);
   // console.log(arr2);
    if(arr1.length==0&&arr2==0&&arr3.length==0)
    {
        return [0] ;
    } 
    if(arr1.length==0&&arr2==0&&arr3.length!==0)
    {
        let result3=arr3.reduce(function(sum,value){
            return sum+value;
        },0);
        arr.push(result3/arr3.length);
        return arr;
    }


  
    let result1 =arr1.reduce(function(sum,value){
        return sum+value;
    },0);
    arr.push(result1/arr1.length);


    let result2 =arr2.reduce(function(sum,value){
        return sum+value;
    },0);
    arr.push(result2/arr2.length);


    let result3=arr3.reduce(function(sum,value){
        return sum+value;
    },0);
    arr.push(result3/arr3.length);

    
    
    return arr;
    
};
module.exports = even_group_calculate_average;
